<!DOCTYPE html>
<html>
<head>
    <title>Index</title>
</head>
<body>
<a href="index.html">This page</a>
<button id="enableBeforeUnload">Enable beforeunload dialog</button>
<script>
    document.getElementById('enableBeforeUnload').onclick = function () {
        window.onbeforeunload = function (e) {
            e.returnValue = 'message';

            return 'message';
        };
    };
</script>
</body>
</html>
